<template>
    <div v-if="readyShow" >
        <span style="color:red;size:18px" v-if="showRecord ">您暂无申报记录</span>
        <el-collapse class="collapseList" v-model="activeNames" accordion v-else="showRecord" >
            <div v-for="_case in caseList">
                <el-collapse-item :title="_case.caseName" >
                    <creditor-list :data="_case.creditorList" :caseId="_case.caseId" style="margin-left: 5%"></creditor-list>
                </el-collapse-item>
            </div>
        </el-collapse>
    </div>
</template>

<script>
    import CreditorList from './creditor-list.vue'
    import util from 'assets/js/util.js'

    export default {
        data() {
            return {
                showRecord:false,
                showCreditorList:[],
                activeNames: [],
                caseList: [],
                readyShow: false,

            }
        },
        mounted() {
            const _self = this;
            util.ajax({
                url: '/index',
                success: function (data) {
                    data.data.forEach(_case => _self.caseList.push({
                        caseId: _case.caseId,
                        caseName: _case.caseName,
                        caseNo:_case.caseNo,
                        creditorList:_case.creditorList,
                    }));
                    _self.activeNames.push(_self.caseList[0].title);
                    if (this.creditorList === '') {
                        _self.showRecord=true;
                    }else{
                        _self.showRecord=false;
                    }
                    _self.readyShow = true;
                },
                error: function(error) {
                    alert("网络请求失败")
                }
            });

        },
        methods: {

        },

        components: {
            CreditorList
        }
    }
</script>

<style>

</style>
